﻿@model Actya.Core.SiteStructure.SitemapNode
<div class="sitemapitem" data-nodeid="@Model.Id">
	@NodeIcon(Model)
	<span class="nodetitle">@Model.Title</span>
	<a href="#" class="cmd editlink" style="display:none">Edit</a>
	@using (Html.BeginForm("delete", "sitemap", new { id = Model.Id }, FormMethod.Post, new { @class = "inline" })) {
		@Html.AntiForgeryToken()
		<a href="#" class="cmd deletelink" style="display:none">Remove from navigation</a>
	}
</div>

@helper NodeIcon(SitemapNode node) {
	var icon = "folder";
	if (! String.IsNullOrEmpty(node.PageId) && ! String.IsNullOrEmpty(node.Url))
	{
		icon = "page";
	}
	else if (String.IsNullOrEmpty(node.PageId) && ! String.IsNullOrEmpty(node.Url))
	{
		icon = "link";
	}
	<img class="nodeicon" src="@Cms.Content(String.Format("Themes/Admin/Images/{0}.png", icon))" alt="@icon" />
}